$(document).ready(function (){
    $(".layui-input").click(function (){
        var str = $(this).attr("id");
        var projectSelectId = str.substr(str.length-1,1)
        var idName = "project"+projectSelectId
        $("#"+idName).css({"display":"block","font-size": "14px"})
        $("input[id^=chapterId]").click(function () {
                var chapterId = $(this).attr("id");
                chapterId = chapterId.substr(chapterId.length-1,1)
                $("#searchExam").click(function () {
                    $.ajax({
                        url: '/exam/selectMathQuestion',
                        type: 'get',
                        data: {projectSelectId: projectSelectId, chapterId: chapterId},
                        success: function (data) {
                            var str = ''
                            for (let i = 0; i < data.length; i++) {
                                str += '<tr><td><input type="checkbox" name="id" value="1" lay-skin="primary"></td>'
                                str += '<th>' + data[i].id + '</th><th>' + data[i].title + '</th><th>' + data[i].answerA + '</th><th>' + data[i].answerB + '</th><th>' + data[i].answerC + '</th><th>' + data[i].answerD + '</th><th>' + data[i].realAnswer + '</th><th>' + data[i].projectSelect + '</th><th>' + data[i].examYear + '</th><th>' + data[i].isImage + '</th>'
                                str += '<td class="td-manage"><a title="编辑"  onclick="xadmin.open(\'编辑\',\'math-edit.html\',600,400)" href="javascript:;"><i class="layui-icon">&#xe642;</i></a><a title="删除" onclick="member_del(this,\'要删除的id\')" href="javascript:;"><i class="layui-icon">&#xe640;</i></a></td></tr>'
                            }
                            $("tbody").html(str)
                        }
                    })
                })
            })
    })
})